<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Spitter</title>
    <link rel="stylesheet"
          type="text/css"
          th:href="@{/resources/style.css}">

    </link>
</head>

<!-- Bootstrap CSS -->
<link  rel="stylesheet"  th:href="@{/css/bootstrap.min.css}"/>
<!-- bootstrap theme -->
<link  rel="stylesheet" type="text/css" th:href="@{/css/bootstrap-theme.css}"/>
<!--external css-->
<!-- font icon -->
<link rel="stylesheet" type="text/css"  th:href="@{/css/elegant-icons-style.css}" />
<link  rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}" />
<!-- full calendar css-->
<link  rel="stylesheet" type="text/css" th:href="@{/assets/fullcalendar/fullcalendar/bootstrap-fullcalendar.css}" />
<link rel="stylesheet"  type="text/css" th:href="@{/assets/fullcalendar/fullcalendar/fullcalendar.css}"  />
<!-- easy pie chart-->
<link  rel="stylesheet" type="text/css" media="screen" th:href="@{/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css}"/>
<!-- owl carousel -->
<link rel="stylesheet" type="text/css" th:href="@{/css/owl.carousel.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/jquery-jvectormap-1.2.2.css}"/>
<!-- Custom styles -->
<link  rel="stylesheet" type="text/css" th:href="@{/css/fullcalendar.css}"/>
<link  rel="stylesheet" type="text/css" th:href="@{/css/widgets.css}"/>
<link  rel="stylesheet" type="text/css" th:href="@{/css/style.css}" />
<link  rel="stylesheet" type="text/css" th:href="@{/css/style-responsive.css}"  />
<link  rel="stylesheet" type="text/css" th:href="@{/css/xcharts.min.css}" />
<link  rel="stylesheet" type="text/css" th:href="@{/css/jquery-ui-1.10.4.min.css}"/>

<!-- jQuery 基础 -->
<%-- <script type="text/javascript" src="${ctx}/js/easyui/jquery/jquery-1.11.1.js" ></script> --%>
<script type="text/javascript" src="${ctx}/js/greatJs/jquery-1.8.0.min.js" ></script>


<script type="text/javascript" src="${ctx}/js/greatJs/amazeui/js/amazeui.min.js"></script>

<!-- easyui 基础包 及语言包-->
<script type="text/javascript" src="${ctx}/js/greatJs/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/js/greatJs/locale/easyui-lang-zh_CN.js" ></script>

<!-- jQuery 插件 -->
<script type='text/javascript' src='${ctx}/js/cookie.js'></script>
<script type='text/javascript' src='${ctx}/js/greatJs/plugins/moment.js'></script>
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/My97DatePicker/WdatePicker.js" ></script>
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/jquery.my97.js" ></script>
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/datagrid-detailview.js" ></script>

<!-- 图片延时加载 -->
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/jquery.scrollLoading.js" ></script>

<!-- 图片上传预览 -->
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/localResizeIMG/lrz.bundle.js"></script>

<!-- multi-select多选 -->
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/multi-select/jquery.multi-select.js"></script>
<script type="text/javascript" src="${ctx}/js/greatJs/plugins/multi-select/jquery.quicksearch.js"></script>

<!-- 项目公共js -->
<script type='text/javascript' src='${ctx}/js/normalutil.js'></script>
<script type="text/javascript" src="${ctx}/js/managegrid.js"></script>
<script type="text/javascript" src="${ctx}/js/greatJs/easywindow.js"></script>
<script type="text/javascript" src="${ctx}/js/greatJs/eventutil.js"></script>
<script type="text/javascript" src="${ctx}/js/json2.js"></script>


<script type="text/javascript">
	Array.prototype.remove=function(dx) {
		if(isNaN(dx)||dx>this.length){
			return false;
		}
		for(var i=0,n=0;i<this.length;i++) {
			if(this[i] != this[dx]) {
				this[n++] = this[i];
			}
		}
		this.length-=1;
	}

	var ctx = "${ctx}";
	
    function reloadlogin() {
        window.top.location.href = "${ctx}/login"
    }
    
    function print() {
        document.execCommand('Print');
    }
    
    //创建查询对象并查询
    function cx() {
        var obj = $("#searchForm").serializeObject();
        $("#dg").datagrid('reload', obj);
    }
    
    function collpase() {
        $("#dg").datagrid('resize');
    }
    
    function getSelectionsId() {
		var pks = $("#dg").datagrid("getSelections");
		if (pks.length == 0) { 
			$.messager.alert('警告','请选择将要删除的数据！');
			return false; 
		}
		var ids = [];
	    for (var i = 0; i < pks.length; i++) {
			if(typeof(pks[i].id) != "undefined"){
				 ids.push(pks[i].id);
			}
	    }
	    return ids;
	}
    
    document.onkeydown=function(event){
    	var e = event || window.event || arguments.callee.caller.arguments[0];
    	if(e && e.keyCode==13){ // enter 键
    		cx();
    	}
    }
    
    /**
     * ajax返回提示
     * @param data	返回的数据
     * @param dg datagrid
     * @param d	弹窗
     * @returns {Boolean} ajax是否成功
     */
     function successTip(data,dg,d){
   	 	if(data=='success'){
     		if(dg!=null)
     			dg.datagrid('reload').datagrid('clearSelections');
     		if(d!=null)
     			d.panel('close');
     		parent.$.messager.show({ title : "提示",msg: "操作成功！", position: "bottomRight" });
     		return true;
     	}else{
     		if(!(data==''||data==null||data==undefined))parent.$.messager.alert('警告',data);
     		return false;
     	}  
   	}
     
	//Dataguid防止标签注入，将标签进行转义
    $.extend($.fn.datagrid.defaults, {
    	loadFilter: function (data) { 
        	for (var i = 0; i < data.rows.length; i++) { 
            	for (var att in data.rows[i]) { 
                	if (typeof (data.rows[i][att]) == "string") { 
                    	data.rows[i][att] = htmlEncode(data.rows[i][att]); 
                   	} else if (typeof (data.rows[i][att]) == "object") { 
                   		// 如有子属性执行以下内容，将内容进行转义
                   		for (var sub in data.rows[i][att]){
                   			if (typeof (data.rows[i][att][sub]) == "string") {
	                   			data.rows[i][att][sub] = htmlEncode(data.rows[i][att][sub]); 
                   			}
                   		}
                   	}
            	} 
        	} 
        	return data; 
    	} 
    }); 
	
  	//Treegrid防止标签注入，将标签进行转义
    $.extend($.fn.treegrid.defaults, {
    	loadFilter: function (data) { 
        	for (var i = 0; i < data.length; i++) { 
            	for (var att in data[i]) { 
                	if (typeof (data[i][att]) == "string") { 
                    	data[i][att] = htmlEncode(data[i][att]); 
                   	}
            	} 
        	} 
        	return data; 
    	} 
    }); 
	
  	//Combobox防止标签注入，将标签进行转义
    $.extend($.fn.combobox.defaults, {
    	formatter: function (row){
    		var opts = $(this).combobox('options');
    		return htmlEncode(row[opts.textField]);
    	}
    }); 
     
    $.extend($.fn.validatebox.defaults.rules, {
        CHS: {
            validator: function(value, param) {
                return /^[\u0391-\uFFE5]+$/.test(value);
            },
            message: '请输入汉字'
        },
        english: { // 验证英语
            validator: function(value) {
                return /^[A-Za-z]+$/i.test(value);
            },
            message: '请输入英文'
        },
        ip: { // 验证IP地址
            validator: function(value) {
                return /\d+\.\d+\.\d+\.\d+/.test(value);
            },
            message: 'IP地址格式不正确'
        },
        ZIP: {
            validator: function(value, param) {
                return /^[0-9]\d{5}$/.test(value);
            },
            message: '邮政编码不存在'
        },
        QQ: {
            validator: function(value, param) {
                return /^[1-9]\d{4,10}$/.test(value);
            },
            message: 'QQ号码不正确'
        },
        mobile: {
            validator: function(value, param) {
                return /^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/.test(value);
            },
            message: '手机号码不正确'
        },
        tel: {
            validator: function(value, param) {
                return /^(\d{3}-|\d{4}-)?(\d{8}|\d{7})?(-\d{1,6})?$/.test(value);
            },
            message: '电话号码不正确'
        },
        mobileAndTel: {
            validator: function(value, param) {
                return /(^([0\+]\d{2,3})\d{3,4}\-\d{3,8}$)|(^([0\+]\d{2,3})\d{3,4}\d{3,8}$)|(^([0\+]\d{2,3}){0,1}13\d{9}$)|(^\d{3,4}\d{3,8}$)|(^\d{3,4}\-\d{3,8}$)/.test(value);
            },
            message: '请正确输入电话号码'
        },
        number: {
            validator: function(value, param) {
                return /^[0-9]+.?[0-9]*$/.test(value);
            },
            message: '请输入数字'
        },
        money: {
            validator: function(value, param) {
                return (/^(([1-9]\d*)|\d)(\.\d{1,2})?$/).test(value);
            },
            message: '请输入正确的金额'

        },
        trimAll: {
            validator: function(value, param) {
                return (/\s*\S+/).test(value);
            },
            message: '请输入正确内容'

        },
//         mone: {
//             validator: function(value, param) {
//                 return (/^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/).test(value);
//             },
//             message: '请输入大于0的整数或小数'

//         },

		mone: {
            validator: function(value, param) {
                return (/^[ + ]?(0\.\d+)|([1-9][0-9]*(\.\d+)?)$/).test(value);
            },
            message: '请输入大于0的整数或小数'

        },

        moneZero: {
        	 validator: function(value, param) {
                 return (/^\d+(\.\d+)?$/).test(value);
             },
             message: '请输入大于等于0的整数或小数'

        },
        integer: {
            validator: function(value, param) {
                return /^[+]?[1-9]\d*$/.test(value);
            },
            message: '请输入最小为1的整数'
        },
        integ: {
            validator: function(value, param) {
                return /^[+]?[0-9]\d*$/.test(value);
            },
            message: '请输入整数'
        },
        range: {
            validator: function(value, param) {
                if (/^(((-)?[0-9]+\.[0-9]{1})|((-)?[0-9]*[1-9][0-9]*)|0)$/.test(value)) {
                    return value >= param[0] && value <= param[1]
                } else {
                    return false;
                }
            },
            message: '输入的数字在{0}到{1}之间<br>且小数位最多为1位'
        },
        minLength: {
            validator: function(value, param) {
                return value.length >= param[0]
            },
            message: '至少输入{0}个字'
        },
        maxLength: {
            validator: function(value, param) {
                return value.length <= param[0]
            },
            message: '最多{0}个字'
        },
        //select即选择框的验证
        selectValid: {
            validator: function(value, param) {
                if (value == param[0]) {
                    return false;
                } else {
                    return true;
                }
            },
            message: '请选择'
        },
        selectValueRequired: {   
            validator: function(value,param){             
                 if (value == "" || value.indexOf('请选择') >= 0) {   
                    return false;  
                 }else {  
                    return true;  
                 }    
            },   
            message: '该下拉框为必选项'   
        },
        idCode: {
            validator: function(value, param) {
                return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(value);
            },
            message: '请输入正确的身份证号'
        },
        loginName: {
            validator: function(value, param) {
                return /^[\u0391-\uFFE5\w]+$/.test(value);
            },
            message: '登录名称只允许汉字、英文字母、数字及下划线。'
        },
        equalTo: {
            validator: function(value, param) {
                return value == $(param[0]).val();
            },
            message: '两次输入的字符不一至'
        },
        englishOrNum: { // 只能输入英文和数字
            validator: function(value) {
                return /^[a-zA-Z0-9_\- ]{1,}$/.test(value);
            },
            message: '请输入英文、数字、下划线、横线或者空格'
        },
        xiaoshu: {
            validator: function(value) {
                return /^(([1-9]+)|([0-9]+\.[0-9]{1,2}))$/.test(value);
            },
            message: '最多保留两位小数！'
        },
        oneTwoH: {
            validator: function(value) {
//                 return /^[1-2]?[0-9]{1,2}/.test(value);
            	if(!isNaN(value)&&value>0&&value<=200){
            		var dout = value.indexOf(".");
            		if(dout<0){
            			return true;
            		}
            	}
            	return false;
            },
            message: '只能输入1到200的整数！'
        },
        ddPrice: {
            validator: function(value, param) {
                if (/^[1-9]\d*$/.test(value)) {
                    return value >= param[0] && value <= param[1];
                } else {
                    return false;
                }
            },
            message: '请输入1到100之间正整数'
        },
        jretailUpperLimit: {
            validator: function(value, param) {
                if (/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
                    return parseFloat(value) > parseFloat(param[0]) && parseFloat(value) <= parseFloat(param[1]);
                } else {
                    return false;
                }
            },
            message: '请输入0到100之间的最多俩位小数的数字'
        },
        rateCheck: {
            validator: function(value, param) {
                if (/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
                    return parseFloat(value) > parseFloat(param[0]) && parseFloat(value) <= parseFloat(param[1]);
                } else {
                    return false;
                }
            },
            message: '请输入0到1000之间的最多俩位小数的数字'
        },
        requireRadio: {  
            validator: function(value, param){  
                var input = $(param[0]);
                input.off('.requireRadio').on('click.requireRadio',function(){
                    $(this).focus();
                });
                return $(param[0] + ':checked').val() != undefined;
            },  
            message: '请至少选择一个{1}.'  
        },
        requireCheckbox: {  
            validator: function(value, param){  
                var input = $(param[0]);
                input.off('.requireCheckbox').on('click.requireCheckbox',function(){
                    $(this).focus();
                });
                return $(param[0] + ':checked').val() != undefined;
            },  
            message: '请至少选择一个{1}.'  
        },
        dateVali: {
			validator: function(value, param){
				var d1 = $.fn.datebox.defaults.parser(param[0]);
				var d2 = $.fn.datebox.defaults.parser(value);
				return d2<=d1;
			},
			message: 'The date must be less than or equals to {0}.'
		},
		email:{
            validator: function(value, param) {
                return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value);
            },
            message: '请输入正确的电子邮箱地址.'
		},
		checkCode:{// 代码是否重复
	        validator: function (value, param) {  
	        	if(param[2] != null){
	        		var relateId = $(param[2]).combobox('getValue');
	        		var checkR=$.ajax({  
		                async : false,    
		                cache : false,  
		                type : 'post',    
		                url : ctx + param[0],
		                data : {
		                	relateId: relateId,
		                	value: value
		                }
		            }).responseText;    
		            return checkR==="true";   
	        	}else{
		            var checkR=$.ajax({  
		                async : false,    
		                cache : false,  
		                type : 'post',    
		                url : ctx + param[0],
		                data : {
		                	value: value
		                }
		            }).responseText;    
		            return checkR==="true";   
	        	}
	        },  
	        message: '{1}已存在，请重新输入'  
	    },
	    checkQuseCode:{// 代码是否重复
	        validator: function (value, param) {  
	        	if(param[2] != null){
	        		var relateId = $(param[2]).val();
	        		var checkR=$.ajax({  
		                async : false,    
		                cache : false,  
		                type : 'post',    
		                url : ctx + param[0],
		                data : {
		                	relateId: relateId,
		                	value: value
		                }
		            }).responseText;    
		            return checkR==="true";   
	        	}else{
		            var checkR=$.ajax({  
		                async : false,    
		                cache : false,  
		                type : 'post',    
		                url : ctx + param[0],
		                data : {
		                	value: value
		                }
		            }).responseText;    
		            return checkR==="true";   
	        	}
	        },  
	        message: '{1}已存在，请重新输入'  
	    },
	    checkSpace:{// 判断空格
            validator: function(value, param) {
                if($.trim(value)!=""){
                	return true;
                }	
            },
            message: '请输入有效的字符.'
	    },
	    checkRights:{//判断权重，0<=x<=1 且小数位只能有两位
            validator: function(value) {
            	return /^[01](\.\d{1,2})?$/.test(value);	
            },
            message: '请输入大于等于0且小于等于1的一位或两位小数.'
	    },
        checkICCaseEvaluateScore: {//判断创新案例，评分输入项
            validator: function(value,param) {
            	if(isNaN(Number(value))) return false;
            	if(Number(value)>Number(param)) return false;
                return /^(([0-9]+)|([0-9]+\.[0-9]{1,2}))$/.test(value);
            },
            message: '评分不能大于此案例项满分,且只能保留两位小数.'
        }
    });
    //定义用户类型对象，模仿枚举
    var userType = 
    {
      factoryManager:"1",
      factoryEmployee:"2",
      clientManager:"3",
      clientEmployee:"4"
    }
    function setIframeHeight(obj) {
		var contents =null;
		var body = null;
		var html = null;
		$(obj).hide(1000,function(){
			$('[name="iframeshow"]').each(function(index,item){
				itemHeight = 0;
				contents = $(item).contents();
				html = contents.find('html');
				body = contents.find('body');
				html.attr('style','outline: 0;padding: 0;margin: 0;border: 0;');
				body.attr('style','outline: 0;padding: 0;margin: 0;border: 0;');
				html.height(body.height());
				$(item).height(body.height()+10);
			});	
		});
		
	};
	//add by guomh 2017-01-03 begin 加入加载等待效果的Js
	var MaskUtil = (function(){    
	      
	    var $mask,$maskMsg;    
	        
	    var defMsg = '正在处理，请稍待...';    
	        
	    function init(){    
	        if(!$mask){    
	            $mask = $("<div class=\"datagrid-mask mymask\"></div>").appendTo("body");    
	        }    
	        if(!$maskMsg){    
	            $maskMsg = $("<div class=\"datagrid-mask-msg mymask\">"+defMsg+"</div>")    
	                .appendTo("body").css({'font-size':'12px'});  
	        }    
	            
	        $mask.css({width:"100%",height:$(document).height()});    
	            
	        $maskMsg.css({    
	            left:($(document.body).outerWidth(true) - 190) / 2,top:($(window).height() - 45) / 2
	        });     
	                    
	    }    
	        
	    return {    
	        mask:function(msg){    
	            init();    
	            $mask.show();    
	            $maskMsg.html(msg||defMsg).show();    
	        }    
	        ,unmask:function(){    
	            $mask.hide();    
	            $maskMsg.hide();    
	        }    
	    }    
	        
	}());
	//add by guomh 2017-01-03 end
	//add by yangxz date 2017-03-30 begin
	(function($) {
	    var methods = {
	        _download: function(options) {
	            var triggerDelay = (options && options.delay) || 100;
	            var removeDelay = (options && options.removeDelay) || 4000;
	            
	            this.each(function(index, item) {
	            	methods._createIFrame(item, index * triggerDelay, removeDelay);
	            });
	        },
	        _createIFrame: function(url, triggerDelay, removeDelay) {
	            //动态添加iframe，设置src，然后删除
	            setTimeout(function() {
	                var frame = $('<iframe style="display: none;" class="multi-download"></iframe>');
	                frame.attr('src', url);
	                $(document.body).after(frame);
	                setTimeout(function() {
	                    frame.remove();
	                }, removeDelay);
	            }, triggerDelay);
	        }
	    };
	 
	    $.fn.multiDownload = function(options) {
	        methods._download.apply(this, arguments);
	    };
	})(jQuery);
	//add by yangxz end
</script>